//#include "WmoGroup.h"
//#include "Common.h"
//#include "MatrixHelper.h"
//#include "WowHelper.h"
//
//WmoGroup::WmoGroup()
//{
//}
//
//WmoGroup::~WmoGroup()
//{
//}
//
//void WmoGroup::Load(std::string path)
//{
//	FILE* file = std::fopen(path.c_str(), "rb");
//	unsigned char	chunkName[4];
//	unsigned int	length;
//
//	std::fseek(file, 12, SEEK_SET);	// Skip MVER.
//
//	WmoGroupMogp mogp;
//
//	std::fread(chunkName, sizeof(unsigned char), 4, file);
//	std::fread(&length, sizeof(unsigned int), 1, file);
//	std::fread(&mogp, sizeof(WmoGroupMogp), 1, file);
//
//	std::fread(chunkName, sizeof(unsigned char), 4, file);
//	std::fread(&length, sizeof(unsigned int), 1, file);
//	std::fseek(file, length, SEEK_CUR);
//
//	std::fread(chunkName, sizeof(unsigned char), 4, file);
//	std::fread(&length, sizeof(unsigned int), 1, file);
//
//	int indexCount = length / 2;
//	unsigned short* indicesShort = new unsigned short[indexCount];
//	unsigned int*	indices = new unsigned int[indexCount];
//
//	std::fread(indicesShort, sizeof(unsigned short), indexCount, file);
//
//	for(int a = 0; a < indexCount; a++)
//	{
//		indices[a] = (int)indicesShort[a];
//	}
//
//	std::fread(chunkName, sizeof(unsigned char), 4, file);
//	std::fread(&length, sizeof(unsigned int), 1, file);
//
//	int vertexCount = length / 12;
//	Vertex*		vertices = new Vertex[vertexCount];
//	Vector3f*	positions = new Vector3f[vertexCount];
//
//	std::fread(positions, sizeof(Vector3f), vertexCount, file);
//
//	for(int a = 0; a < vertexCount; a++)
//	{
//		Convert(&positions[a]);
//
//		vertices[a].Position = positions[a];
//	}
//
//	Vector3f* normals = new Vector3f[vertexCount];
//
//	std::fread(chunkName, sizeof(unsigned char), 4, file);
//	std::fread(&length, sizeof(unsigned int), 1, file);
//	std::fread(normals, sizeof(Vector3f), vertexCount, file);
//	
//	for(int a = 0; a < vertexCount; a++)
//	{
//		Convert(&normals[a]);
//
//		vertices[a].Normal = normals[a];
//	}
//
//	m_pIndexBuffer = new IndexBuffer();
//	m_pIndexBuffer->SetData(indices, sizeof(unsigned int) * indexCount);
//
//	m_pVertexBuffer = new VertexBuffer();
//	m_pVertexBuffer->SetData(vertices, sizeof(Vertex) * vertexCount);
//
//	delete [] vertices;
//	delete [] positions;
//	delete [] indices;
//
//	std::fclose(file);
//}
//
//void WmoGroup::Draw(GLenum drawType) const
//{
//	glEnable(GL_LIGHTING);
//	glEnable(GL_LIGHT0);
//	glDisable(GL_TEXTURE_2D);
//
//	float global_ambient[] = { 0.5f, 0.5f, 0.5f, 1.0f };
//	float ambient[] = { 1.0f, 1.0f, 1.0f };
//	float position[] = { 32.0f, 32.0f, 32.0f, 1.0f };
//	glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
//	glLightfv(GL_LIGHT0, GL_POSITION, position);
//	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, global_ambient);
//	
//	glMatrixMode(GL_MODELVIEW);
//	glPushMatrix();
//
//	Quaternion rotation = GetRotation();
//	Matrix matrix;
//	MatrixHelper::LoadIdentity(matrix);
//	MatrixHelper::SetRotation(matrix, rotation);
//
//	glMultMatrixf(matrix);
//	glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_pVertexBuffer->GetID());
//	glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_pIndexBuffer->GetID());
//	glEnableClientState(GL_VERTEX_ARRAY);
//	glEnableClientState(GL_NORMAL_ARRAY);
//	glVertexPointer(3, GL_FLOAT, sizeof(Vertex), 0);
//	glNormalPointer(GL_FLOAT, sizeof(Vertex), BUFFER_OFFSET(28));
//	glPolygonMode(GL_FRONT, drawType);
//	glDrawElements(GL_TRIANGLES, m_pIndexBuffer->GetElementCount(), GL_UNSIGNED_INT, 0);
//	glDisableClientState(GL_VERTEX_ARRAY);
//	glDisableClientState(GL_NORMAL_ARRAY);
//	glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
//	glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
//	glDisable(GL_LIGHTING);
//
//	glPopMatrix();
//}